.li-dog {
  width: 100%;
  height: 100%;
  display: flex;
  flex-flow: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;

  &.moving {
    .ball {
      &:after {
        animation: bounce 400ms infinite alternate;
      }
      &:before {
        animation: bounce-shadow 400ms infinite alternate;
      }
    }

    .dog {
      .dog-body {
        animation: dog-body 200ms ease-in-out infinite alternate;
        &:before {
          animation: dog-tail-blur 200ms 33.33333ms ease-in-out infinite
            alternate both;
        }
        & > .dog-tail {
          bottom: 90%;
          animation: dog-tail 200ms ease-in-out infinite alternate;
        }
      }

      .dog-head {
        animation: dog-head 1800ms cubic-bezier(0.11, 0.79, 0, 0.99) infinite;
      }

      .dog-torso {
        top: -20%;
        animation: dog-torso 200ms ease-in-out infinite alternate-reverse;
      }

      .dog-eyes {
        .dog-eye {
          animation: dog-eye 1800ms infinite;
        }
      }

      .dog-muzzle {
        .dog-tongue {
          animation: dog-tongue 1800ms -50ms ease-in-out infinite;
          &:before {
            animation: dog-tongue-inner 100ms ease-in-out infinite alternate;
          }
        }
      }

      .dog-ears {
        animation: dog-ears 1800ms 100ms ease infinite;
      }
    }
  }

  .ball {
    width: 32rpx;
    height: 32rpx;
    border-radius: 50%;
    z-index: 0;
    position: relative;
    transform: scale(0.36, 0.36);

    &:after {
      content: '';
      position: absolute;
      display: block;
      top: 0;
      left: 0;
      height: 100%;
      width: 100%;
      border-radius: 50%;
      box-shadow: inset 0 -8rpx 0 0 rgba(0, 0, 0, 0.2);
      background: #6e64f0;
      z-index: 1;
    }

    &:before {
      content: '';
      position: absolute;
      display: block;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border-radius: 50%;
      background: rgba(0, 0, 0, 0.05);
      z-index: -10;
    }
  }

  .dog {
    width: 100rpx;
    height: 100rpx;
    z-index: 1;
    position: relative;
    transform: scale(0.36, 0.36);
    margin-top: 10rpx;

    &:before {
      content: '';
      display: block;
      position: absolute;
      width: 100%;
      height: 100%;
      border-radius: 50%;
      background: rgba(0, 0, 0, 0.03);
      transform: translateY(-30%) scale(1.5);
    }

    .dog-body,
    .dog-torso,
    .dog-head {
      border-radius: 50%;
      background: white;
      position: absolute;
      height: 100%;
      width: 100%;
    }

    .dog-body {
      position: absolute;
      top: -50%;

      &:before {
        content: '';
        position: absolute;
        bottom: 90%;
        right: 50%;
        width: 90%;
        height: 90%;
        border-top-left-radius: 100%;
        border-bottom-left-radius: 10%;
        border-top-right-radius: 10%;
        background: rgba(255, 255, 255, 0.4);
        transform-origin: right bottom;
      }

      .dog-tail {
        width: 22rpx;
        height: 24.2rpx;
        background: white;
        bottom: 40%;
        border-radius: 11rpx;
        left: calc(50% - 11rpx);
        position: absolute;
        transform-origin: center bottom;
      }
    }

    .dog-body > .dog-tail {
      bottom: 90%;
    }

    .dog-eyes {
      width: 60%;
      top: 55%;
      left: 20%;
      z-index: 1;
      position: absolute;

      &:before {
        content: '';
        display: block;
        height: 40rpx;
        width: 40rpx;
        border-radius: 40rpx;
        position: absolute;
        background: orange;
        top: -10rpx;
        left: -10rpx;
        z-index: 0;
        border: 4rpx solid white;
        border-left-width: 0;
        border-bottom-width: 0;
        border-top-width: 0;
        transform: rotate(-45deg);
      }

      .dog-eye {
        width: 10rpx;
        height: 10rpx;
        border-radius: 50%;
        background: #000;
        z-index: 1;
        position: absolute;

        &:first-child {
          left: 0;
        }
        &:last-child {
          right: 0;
        }
      }
    }

    .dog-muzzle {
      width: 60%;
      left: 20%;
      height: 50%;
      border-bottom-left-radius: 100%;
      border-bottom-right-radius: 100%;
      background: white;
      bottom: -15%;
      position: absolute;

      &:before,
      &:after {
        content: '';
        display: block;
        position: absolute;
      }
      &:before {
        width: 6rpx;
        height: 20rpx;
        bottom: 0;
        left: calc(50% - 3rpx);
        background: #eaebec;
      }
      &:after {
        background: black;
        width: 20rpx;
        height: 15rpx;
        bottom: 12rpx;
        left: calc(50% - 10rpx);
        border-bottom-left-radius: 60% 60%;
        border-bottom-right-radius: 60% 60%;
        border-top-left-radius: 50% 40%;
        border-top-right-radius: 50% 40%;
      }

      .dog-tongue {
        width: 40rpx;
        height: 100%;
        left: calc(50% - 20rpx);
        z-index: -1;
        transform-origin: center top;
        position: absolute;

        &:before {
          content: '';
          position: absolute;
          display: block;
          width: 100%;
          height: 100%;
          border-radius: 40rpx;
          background: #fd3163;
        }
      }
    }

    .dog-ears {
      width: 40%;
      top: 25%;
      left: 30%;
      position: absolute;

      .dog-ear {
        bottom: -10rpx;
        height: 50rpx;
        width: 50rpx;
        background: #eaebec;
        animation-duration: 400ms;
        animation-direction: alternate;
        animation-timing-function: ease-in-out;
        animation-fill-mode: both;
        animation-iteration-count: infinite;
        position: absolute;

        &:first-child {
          border-bottom-left-radius: 80%;
          border-top-right-radius: 80%;
          right: 100%;
          box-shadow: inset -15rpx 15rpx 0 1rpx white;
          transform-origin: right bottom;
          transform: rotate(10deg);
        }
        &:last-child {
          border-top-left-radius: 80%;
          border-bottom-right-radius: 80%;
          left: 100%;
          box-shadow: inset 15rpx 15rpx 0 0 white;
          transform-origin: left bottom;
          transform: rotate(-10deg);
        }
      }
    }
  }
}

@keyframes bounce {
  from {
    transform: scale(2);
    animation-timing-function: ease-in;
  }
  to {
    transform: scale(0.8);
    animation-timing-function: cubic-bezier(0, 0, 0, 1);
  }
}

@keyframes bounce-shadow {
  from {
    transform: scale(2.5, 2.6) translateY(-50%);
    animation-timing-function: ease-in;
  }
  to {
    transform: scale(0.5) translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0, 1);
  }
}

@keyframes dog-tail-blur {
  from {
    transform: rotate(0);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  to {
    transform: rotate(90deg);
    opacity: 0;
  }
}

@keyframes dog-body {
  from {
    transform: translateX(-10%);
  }
  to {
    transform: translateX(10%);
  }
}

@keyframes dog-head {
  from,
  to {
    transform: rotate(45deg);
  }
  33.3% {
    transform: rotate(-45deg);
  }
  66.6% {
    transform: rotate(0);
  }
}

@keyframes dog-torso {
  from {
    transform: translateX(-5%);
  }
  to {
    transform: translateX(5%);
  }
}

@keyframes dog-eye {
  from,
  to {
    animation-timing-function: step-end;
    opacity: 1;
  }
  50%,
  55% {
    animation-timing-function: step-start;
    opacity: 0;
  }
}

@keyframes dog-tongue {
  from,
  to {
    transform: rotate(0);
  }
  16.66667% {
    transform: rotate(30deg);
  }
  33.33333%,
  66.66667% {
    transform: rotate(0);
  }
  50%,
  83.33333% {
    transform: rotate(-20deg);
  }
}

@keyframes dog-tongue-inner {
  from {
    transform: translateY(5%);
  }
  to {
    transform: translateY(22%);
  }
}

@keyframes dog-ears {
  42.3%,
  71.6% {
    transform: rotate(-5deg);
  }
  50.3%,
  79.6% {
    transform: rotate(5deg);
  }
  5% {
    transform: rotate(5deg);
  }
  12% {
    transform: rotate(-5%);
  }
  from,
  33.3%,
  66%,
  to {
    transform: rotate(0);
  }
}

@keyframes dog-tail-segment {
  from {
    transform: rotate(-10deg);
  }
  to {
    transform: rotate(10deg);
  }
}

@keyframes dog-tail {
  from {
    transform: rotate(-45deg);
  }
  to {
    transform: rotate(45deg);
  }
}
